home *** CD-ROM | disk | FTP | other *** search
Text File | 1986-02-25 | 1.1 KB | 37 lines | [TEXT/MACA] |
- \ Floating Point Demo
- \ 2/11/86 cdn Version 1
-
- \ 340. 512. f/ \ Mac screen pixel ratio
- \ 4.625 6.875 f/ \ Mac screen physical size
-
- 0. fValue x
- 0. fValue y
- 0. fValue Shft
- 2. fValue Inc
-
- : Sines { %Rad %Amp %nCYC %Pas \ %i %theta -- } localfloat
- \ getRect: fWind >float 2. f/ -> y >float 2. f/ -> x 2drop
-
- %Pas 1/x %nCyc f+ -> %nCyc \ Adjust # of cycles according to passes
- Shft deg2rad -> Shft \ Convert shift angle to radians
- %Rad %Amp f+ \ Compute starting radius
- fDup Shft COS f* x f+ float>
- swap Shft SIN f* y f+ float>
- pack call MoveTo \ Move plotter to starting position
-
- %Pas 360. f* Inc f+ Inc -> %i
- BEGIN
- %i deg2rad \ Convert degrees to radians
- fDup Shft f+ -> %theta \ theta = theta' + Shft
- %nCyc f* COS %Amp f* %Rad f+ \ COS(theta' * #Cyc) * Amp + rad
- fDup %theta COS f* x f+ float>
- swap %theta SIN f* y f+ float>
- pack call LineTo \ Plot To r*COS(theta)+x , r*SIN(theta)+y
- %i Inc f+ -> %i
- %i fOver f>
- UNTIL
- fDrop
- ;
-
- : test 25. 75. 12. 1. Sines ;
-